<template>
	<view>
		<van-nav-bar title="拍卖预约" left-text="返回" left-arrow @click-left="onClickLeft" />
		<view class="box">
			<view v-show="Pitera" style="margin: 100px auto;">
				<van-empty description="暂无预约" />
			</view>
			<view  class="goods" v-for="(item,index) in Subscribe" :key="index" >
				<view class="">
					<img style="width: 320rpx;height: 320rpx;border-radius:5%;margin-left: 10rpx;" :src="item.commodityImg" alt="">
				</view>
				<view style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;font-weight: bold;">
					{{item.commodityName}}
				</view>
				<view>
					起拍价：<span style="color: red;font-weight: bold;">￥{{item.originalPrice}}</span>
				</view>
				<view >
					<button @click="updateappointment(item.auctionId)" style="height: 30px;line-height:30px;background-color: darkgrey;color:aliceblue">取消预约</button>
				</view>
				
			</view>
		</view>
	</view>
</template>

<script>
	import request from '../../com/request.js'
	export default {
		data() {
			return {
				Subscribe:[],
				Pitera:true
			}
		},
		methods: {
			onClickLeft() {
				uni.redirectTo({
					url: '/pages/MyCenter/MyCenter'
				});
			  },
			updateappointment(auctionId){
				request({
					url: 'api/updateappointment',
					data: {
						auctionId:auctionId,
						userTel:uni.getStorageSync("userTel"),
					},
					method:"POST",
					success: (resp) => {
						this.selsectAuctionSubscribe()
					}
				})
			},
			selsectAuctionSubscribe(){
				request({
					url: 'api/auctionSubscribe/get',
					data: {
						acc: uni.getStorageSync("userTel")
					},
					success: (resp) => {
						this.Subscribe=resp.data.data
						if(this.Subscribe.length>0){
							this.Pitera=false
						}else{
							this.Pitera=true
						}
						console.log(this.Subscribe,29)
					}
				})
			}
		},
		onLoad(){
			this.selsectAuctionSubscribe()
		}
	}
</script>

<style>
.goods{
	width: 350rpx;
	margin-left: 22rpx;
	margin-top: 15px;
}
.box{
	display:flex;
	flex-wrap: wrap;
}
</style>
